package Traversal_of_sets_package1;

import java.util.ArrayList;

public class Traversal_of_sets_demo1 {
    public static void main(String[] args) {
        //1、创建集合
        ArrayList<String> list = new ArrayList<>();

        //2、添加元素
        list.add("点赞了吗？");
        list.add("收藏了吗？");
        list.add("投币了吗？");
        list.add("转发了吗？");

        //3、遍历
        System.out.print("[");
        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1) {
                System.out.print(list.get(i));
            } else {
                System.out.print(list.get(i) + ", ");
            }
        }

        System.out.println("]");
    }
}
